﻿@using Abp.MultiTenancy
@using AbpCompanyName.AbpProjectName.MultiTenancy
<div>
    <form name="tenantCreateForm" role="form" novalidate class="form-validation">
        <div class="modal-header">
            <h4 class="modal-title">
                <span>@L("CreateNewTenant")</span>
            </h4>
        </div>
        <div class="modal-body">

            <div class="form-group">
                <label>@L("TenancyName")</label>
                <input auto-focus class="form-control" type="text" name="TenancyName" ng-model="vm.tenant.tenancyName" required maxlength="@Tenant.MaxTenancyNameLength" ng-pattern="/@Tenant.TenancyNameRegex/">
            </div>
            <div>
                <span class="help-block text-danger" ng-show="!tenantCreateForm.TenancyName.$valid && tenantCreateForm.TenancyName.$dirty">@L("TenantName_Regex_Description")</span>
            </div>

            <div class="form-group">
                <label>@L("Name")</label>
                <input type="text" name="Name" class="form-control" ng-model="vm.tenant.name" required maxlength="@Tenant.MaxNameLength">
            </div>

            <div class="form-group">
                <label>@L("DatabaseConnectionString") (@L("Optional"))</label>
                <input type="text" name="ConnectionString" class="form-control" ng-model="vm.tenant.connectionString" maxlength="@AbpTenantBase.MaxConnectionStringLength">
            </div>

            <div class="form-group">
                <label>@L("AdminEmailAddress")</label>
                <input type="email" name="AdminEmailAddress" class="form-control" ng-model="vm.tenant.adminEmailAddress" required maxlength="@AbpCompanyName.AbpProjectName.Users.User.MaxEmailAddressLength">
            </div>

            <p>@L("DefaultPasswordIs", AbpCompanyName.AbpProjectName.Users.User.DefaultPassword)</p>

        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" ng-click="vm.cancel()">@L("Cancel")</button>
            <button type="submit" class="btn btn-primary blue" ng-click="vm.save()" ng-disabled="tenantCreateForm.$invalid"><i class="fa fa-save"></i> <span>@L("Save")</span></button>
        </div>
    </form>
</div>